package org.vectrics.mail;

import java.util.ArrayList;
import java.util.Collection;

import org.vectrics.domain.Domain;
import org.vectrics.user.Person;


/**
 * @author mmoore
 */
public abstract class NotificationProvider {
	private static NotificationProvider instance = null;
	
	/**
	 * 
	 */
	public NotificationProvider() {
		super();
		instance = this;
	}
	
	public static NotificationProvider getInstance() {
		return(instance);
	}

	protected abstract void doSendMessage(Collection userIds, MailMessage message) throws MailException;
	
	
	public void sendMessage(Collection persons, MailMessage message) throws MailException {
		if (persons.size() > 0) {
			this.doSendMessage(persons, message);
		}
	}
	
	public void sendMessage(Person person, MailMessage message) throws MailException {
	    Collection persons = new ArrayList();
	    persons.add(person);
		this.doSendMessage(persons, message);
	}
	
}
